#test for failure Alex Michel
# returns 0 if the error code returned was what is expected -1 otherwise

#variable : X => whatever number for error code we are trying to test 
#variable Y => expected return value

SET r0 3
SET r1 -4
SET r2 0

#push test num to stack and system call 
PUSH r1
PUSH r0
TRAP

#system call should return error value
POP r2
BNE r1 r2 failed #branch if returned value is what was expected failed otherwise

:passed
SET r3 1
SET r4 0
BRANCH print

:failed
SET r3 1 
SET r4 -1
BRANCH print

:print
PUSH r4
PUSH r3
TRAP

:end



